<template>
  <div>
    <modal ref="myModal" type="success">
      <template #default>This is Header</template>
      <template #content>This is Content</template>
    </modal>
    <button @click="openModal">Open Modal</button>
  </div>
</template>

<script>
import Modal from './components/Modal.vue';

export default {
  name: 'App',
  components: { Modal },
  data() {
    return {};
  },
  methods: {
    openModal() {
      //调用子组件Modal实例里面的方法
      this.$refs.myModal.openModal();
    }
  }
};
</script>
